package cn.lyh.myiot.service;

import cn.lyh.myiot.pojo.WenshiduTable;
import cn.lyh.myiot.pojo.mapper.WenshiduTableMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lyh
 * @version 1.0
 * @date 2020/8/15
 */
@Service
public class WenshiduService {

    final
    WenshiduTableMapper wenshiduTableMapper;

    public WenshiduService(WenshiduTableMapper wenshiduTableMapper) {
        this.wenshiduTableMapper = wenshiduTableMapper;
    }

    public List<WenshiduTable> getWenshidu(){
        Page<WenshiduTable> wenshiduTablePage = new Page<>(0, 1);
        wenshiduTablePage = wenshiduTableMapper.selectPage(wenshiduTablePage,
                new QueryWrapper<WenshiduTable>().orderByDesc("id"));
        return wenshiduTablePage.getRecords();
    }

}
